/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.NumberFormat;

/**
 * <p>Project: app2022 - Format4
 * <p>Powered by webrx On 2022-01-05 14:32:13
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Format4 {
    public static void main(String[] args) {
        //数字格式化
        NumberFormat nf = NumberFormat.getPercentInstance();
        //小数位
        nf.setMaximumFractionDigits(4);
        System.out.println(nf.format(.0192525));
        nf.setMaximumFractionDigits(0);
        System.out.println(nf.format(.29));

        var nf2 = NumberFormat.getCurrencyInstance();
        nf2.setMaximumFractionDigits(0);
        System.out.println("" + nf2.format(1008.9999));

        var nf3 = NumberFormat.getInstance();
        nf3.setMaximumFractionDigits(2);
        System.out.println(nf3.format(10000.425124));
    }
}
